<?php get_header(); ?>
<div class="row" id="main-row">
  <div id="equalheight" class="mikubox">
  <?php get_sidebar(); ?> 
  <div class="col-md-9 col-sm-9 main-col">
  <main>
	<?php
    $paged = get_query_var('paged');

    function paged() {
      global $paged;
      if($paged){
        return " 第" . $paged . "页";
      }
    }

		if(is_day()) echo the_time('Y年m月j日');
		elseif(is_month()) echo the_time('Y年m月');
		elseif(is_year()) echo the_time('Y年'); 
    
    if(is_category()){
      echo "<h3 class='archive-header-name'><span class='glyphicon glyphicon-folder-open'></span> 分类: ".single_cat_title( '', false )." ".paged()."</h3>";
      echo '<hr class="archive-header-hr">';
    }else if(is_author()){
      global $wp_query;
      $curauth = $wp_query->get_queried_object();
      echo "<h3 class='archive-header-name'><span class='glyphicon glyphicon-user'></span> ".$curauth->display_name."的文章 ".paged()."</h3>";
      if ( $curauth->description ) echo '<div class="archive-header-info">'.$curauth->description.'</div>';
      echo '<hr class="archive-header-hr">';
    }else if(is_search()){
      if ( !have_posts() ) :
        echo '<h3 class="archive-header-name">没有找到有关【'. $s .'】的内容</h3>';
      else:
        echo '<h3 class="archive-header-name">有关【'. $s .'】的内容 '.paged().'</h3>';
      endif;
      echo '<div class="archive-header-info">'.get_bloginfo( 'description', 'display' ).'</div>';
      echo '<hr class="archive-header-hr">';
    }else if($paged){
      echo '<h3 class="archive-header-name">最新发布 '. paged() .'</h3>';
      echo '<hr class="archive-header-hr">';
    }

    if ( have_posts() ) :
			while ( have_posts() ) : the_post();
				get_template_part( 'content', get_post_format() );

			endwhile;
			
		endif; 

    the_posts_pagination( array(
				'prev_text'          => __( '上一页', 'huaji-pro' ),
				'next_text'          => __( '下一页', 'huaji-pro' )
		) );
    ?>
  </main>
  </div>
  </div>
</div>
<?php get_footer(); ?>